package com.lagou.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/resultful")
public class ResultfulController {
    // 组合注解:组合@Controller+@ResponseBody
    // @PathVariable 用来获取restful风格url里边占位符的值

    @GetMapping("/user/{id}")  // 相当于@RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    //@ResponseBody
    public String findById(@PathVariable Integer id){
        return "findById"+id;
    }

    /**
     * 新增方法
     */
    @PostMapping("/user")
    public String insert(){
        return "insert";
    }

    /**
     * 更新方法
     */
    @PutMapping("/user")
    public String put(){
        return "put";
    }

    /**
     * 删除方法
     */
    @DeleteMapping("/user/{id}")
    public String delete(@PathVariable Integer id){
        return "delete";
    }

}
